<?php
require_once '../../classes/includeAll_Layer2.php';
require_once '../../resources/getConnection.php';

$RoomAndLevelClass = new roomAndLevel($connection);
$levels=$RoomAndLevelClass->getAllLevel();
$roomName = array();
$roomAndID = array();
$roomID = array();

foreach($levels as $level) 
{
    $roomsPerLevel=$RoomAndLevelClass->getAllRoomsPerLevel($level['ID']) ;  
    foreach ($roomsPerLevel as $room) 
        {
        array_push($roomName, $room['name']);
        array_push($roomID, $room['ID']);
        }
}

array_multisort($roomName, $roomID);

for($i=0; $i< count($roomName);$i++) 
{
    
    echo $roomName[$i].",".$roomID[$i] . ";";
    
}
$connection->disconnectDB();
?>

